package com.oj.api.core.domain;

import com.oj.common.domain.BaseInfo;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Date;
import java.util.List;

/**
 * 题目集对象
 * Created by Bing on 2018/5/4.
 */
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class ProblemSetInfo extends BaseInfo{

    private static String[] typeNames = {"考试","练习"};

    private static String[] timeTypeNames = {"固定时长","固定时间"};

    private static String[] statusNames = {"一直可用","不可用"};

    /**
     * 单位
     */
    protected String company;

    /**
     * 类型
     */
    protected Integer type;

    /**
     * 时间类型
     */
    protected Integer timeType;
    /**
     * 开始时间
     */
    protected Date startTime;
    /**
     * 结束时间
     */
    protected Date endTime;
    /**
     * 公告
     */
    protected String notice;
    /**
     * 编译器
     */
    protected String originCode;

    /**
     * 题目信息
     */
    protected List<ProblemInfo> problems;
    /**
     * 是否公开
     */
    private int open;

    public String getTypeName(){
        if(type!=null&&type>=0&&type<typeNames.length){
            return typeNames[type];
        }else{
            return "未知";
        }
    }

    public String getTimeTypeName(){
        if(timeType!=null&&timeType>=0&&timeType<timeTypeNames.length){
            return timeTypeNames[timeType];
        }else{
            return "未知";
        }
    }

    public String getStatusName() {
        if (status!=null && status>=0 && status<statusNames.length){
            return statusNames[status];
        }else {
            return "未知";
        }
    }

}
